import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import ProjectFileView from '../views/ProjectFileView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/RegisterView.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/LoginView.vue')
  },
  {
    path: '/projectTable',
    name: 'projectTable',
    component: () => import('../views/ProjectTableView.vue')
  },
  {
    path: '/projectFile',
    name: 'projectFile',
    component: ()  => <ProjectFileView title="上传项目文件" name="excel" action="http://localhost:8080/api/project"/>
  },
  {
    path: '/projectDetails',
    name: 'projectDetails',
    component: ()  => import('../views/ProjectDetailsView.vue')
  },
  {
    path: '/projectMenu',
    name: 'projectMenu',
    component: ()  => import('../views/ProjectMenuView.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
